package com.bdqn.wang.dao.impl;


import com.bdqn.wang.dao.UserDao;
import com.bdqn.wang.pojo.Menber;
import com.bdqn.wang.pojo.User;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class UserDaoImpl extends BaseDao implements UserDao {

    @Override
    public int kais(String name, String pwd) {
        PreparedStatement preparedStatement=null;
        ResultSet resultSet = null;
        Connection connection = null;
        try {
            connection = getConnection();
        String sql = "select * from easybuy_user  where loginName =? and password = ? ";
        preparedStatement = connection.prepareStatement(sql);
        preparedStatement.setObject(1,name);
        preparedStatement.setObject(2,pwd);
            resultSet = preparedStatement.executeQuery();
        if (resultSet.next()){
            return 1;
        }
        } catch (SQLException e) {
            e.printStackTrace();
        }
      return 0;
    }

    @Override
    public int addUser(User user) {
        return 0;
    }




    @Override
    public boolean userExit(String loginName) {
        return false;
    }

}
